﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace COFE.Core.Actions
{
    public class WorkEventArgs : EventArgs
    {
        public Guid ID { get; private set; }      

        /// <summary>
        /// Work Description.
        /// </summary>
        public string WorkDescription { get; private set; }

        public EventType WorkEventType { get; private set; }
        public string Message { get; protected set; }

        public WorkEventArgs(Guid id, string description, EventType wet, string message = null)
        {
            ID = id;            
            WorkDescription = description;            
            WorkEventType = wet;
            Message = message;
        }

        public WorkEventArgs(IWork work, EventType wet, string message = null)
        {
            WorkEventType = wet;
            
            if (work != null)
            {
                ID = work.ID;                
                WorkDescription = work.Description;
            }
            else
            {
                ID = Guid.Empty;                
                WorkDescription = "Unspecified";
            }

            Message = message;
        }        

        public override string ToString()
        {
            return String.Format(COFEShared.LogSyntax, WorkEventType,
                Message == null ? WorkDescription : Message);            
        }
    }
}
